package com.ponhu.ea2.stockcenter.provider.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;
import java.io.Serializable;

/**
 * <p>
 * 货品批次库存表
 * </p>
 *
 * @author ${author}
 * @since 2022-03-09
 */
@Data
@Accessors(chain = true)
@TableName(value = "ph_stock_inventory_batch_record")
public class StockInventoryBatchRecord implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 货品ID
     */
    private Long inventoryId;

    /**
     * 货品编码
     */
    private String inventoryCode;

    /**
     * 批次编码
     */
    private String batchCode;

    /**
     * 批次实物库存数
     */
    private Integer batchNum;

    /**
     * 最近修改时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE, update = "NOW()")
    private LocalDateTime updateTime;

    /**
     * 创建时间
     */
    private LocalDateTime createTime;

    /**
     * 逻辑删除：0-否，1-是
     */
    private Boolean deleted;

    public String getInventoryCodeAndBatchCode() {
        return String.format("%s_%s", inventoryCode, batchCode);
    }

}
